import { ApiProperty } from '@nestjs/swagger'
import { Type } from 'class-transformer'
import { IsEnum, IsInt, IsNotEmpty, IsOptional, IsString, MaxLength } from 'class-validator'
import { WorkType } from '../entities/wall.entity'

export class UploadWorkDto {
  @ApiProperty({ description: '作品标题', example: '我的英语演讲' })
  @IsNotEmpty({ message: '作品标题不能为空' })
  @MaxLength(500, { message: '作品标题不能超过500个字符' })
  workTitle: string

  @ApiProperty({ description: '作品描述', required: false, example: '这是我在英语课上的演讲视频' })
  @IsOptional()
  @IsString({ message: '作品描述必须是字符串' })
  workDescription?: string

  @ApiProperty({ description: '作品类型：2-视频，3-音频', enum: WorkType, default: WorkType.Video })
  @IsEnum(WorkType, { message: '无效的作品类型' })
  @Type(() => Number)
  workType: WorkType

  @ApiProperty({ description: '学生ID', example: 1 })
  @IsNotEmpty({ message: '学生ID不能为空' })
  @Type(() => Number)
  studentId: number

  @ApiProperty({ description: '班级ID或班级编号', required: false, example: 'CLS2025000002' })
  @IsOptional()
  @IsString({ message: '班级ID必须是字符串' })
  classId?: string

  @ApiProperty({ description: '标签ID列表', required: false, example: [1, 2, 3] })
  @IsOptional()
  @IsInt({ each: true, message: '标签ID必须是整数数组' })
  @Type(() => Number)
  tagIds?: number[]

  // 封面文件在MultipartFile中处理，不在DTO中验证
} 